/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.gunncs;

import java.awt.Graphics;
import java.util.Vector;
/**
 *
 * @author anand
 */
public abstract class SensorModel {
    public static final int HISTORY_SIZE = 15;
    protected double[] state;
    Vector<double[]> history;
    public SensorModel(){
      history = new Vector<double[]>();
    }
    public double[] getState() {
        return state;
    }

    public void setState(double[] state) {
        this.state = state;
    }

    public void setState(String state){ //Uses a ";" separated list to set state
        String[] values = state.split(";");
        double[] newState = new double[values.length];
        for(int i=0; i<values.length; i++){
            newState[i] = Double.parseDouble(values[i].trim());
        }
        history.add(newState);
        if(history.size()>HISTORY_SIZE){
          history.remove(0);
        }
        setState(newState);
    }

    public abstract void drawAt(Graphics g, int x, int y, double theta);
    
}
